package com.longge;

public class SumNumbers {

    int ans = 0;
    StringBuilder sb = new StringBuilder();


    public int sumNumbers(TreeNode root) {
        if (root == null) {
            return 0;
        }
        sb.append(root.val);
        if (root.left == null && root.right == null) {
           ans+= Integer.parseInt(sb.toString());
        }
        sumNumbers(root.left);
        sumNumbers(root.right);
        sb.deleteCharAt(sb.length() - 1);
        return ans;
    }

    public static void main(String[] args) {
        String a = "16389672287,13846650560,18322947367,13974708177,18862760954,13060102472,12540431107,14561682926,18068679203,18153294239,14648809382,15641728362,15601693556,17109140842,11126552303,19994179837,13081540560,19416614707,13807112974,17820719069,18537294797,13525245978,19804759107,14832533991,18961116576,16163525364,13680675865,19555668264,12326421376,16175141006,13334681123,11353877202,17286841108,18504076488,19554595581,18343290056,17942751870,11905912487,11642911511,13014738891,18491770858,15286006312,13491833440,15695750590,17886147169,14582511963,12908050695";
        int length = a.split(",").length;
        System.out.println(length);
    }


}
